package cn.iocoder.yudao.module.trade.scan.vo;

import cn.iocoder.yudao.framework.business.order.pojo.vo.BizOrderVO;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.module.api.promotion.gift.dto.GiftActivityVO;
import cn.iocoder.yudao.module.api.shop.info.dto.ShopInfoDTO;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

/**
 * 下线扫码订单 VO
 *
 * @author 山野羡民
 */
@Data
public class AdminScanOrderVO extends BizOrderVO {

    @Schema(description = "店铺编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5036")
    private Long shopId;

    @Schema(description = "店铺名称", deprecated = true, requiredMode = Schema.RequiredMode.REQUIRED, example = "5036")
    @Deprecated
    private String shopName;

    @Schema(description = "店铺徽标", deprecated = true)
    @Deprecated
    private String shopLogo;

    @Schema(description = "店铺信息", requiredMode = Schema.RequiredMode.REQUIRED)
    private ShopInfoDTO shop;

    @Schema(description = "原始金额，单位：分")
    private Integer originPrice;

    @Schema(description = "会员减免金额，单位：分")
    private Integer vipExemptPrice;

    @Schema(description = "积分抵扣金额，单位：分")
    private Integer pointDeductPrice;

    @Schema(description = "联盟豆抵扣金额，单位：分")
    private Integer cryptocurrencyDeductPrice;

    @Schema(description = "使用的积分")
    private Integer deductPoint;

    @Schema(description = "使用的联盟豆")
    private Integer deductCryptocurrency;

    @Schema(description = "红包抵扣金额，单位：分")
    private Integer redpacketDeductPrice;

    @Schema(description = "打折、优惠券的优惠金额，单位：分")
    private Integer discountPrice;

    @Schema(description = "优惠券编号")
    private Long couponId;

    @Schema(description = "用户备注")
    private String userRemark;

    @Schema(description = "赠品活动编号集")
    private List<Long> giftActivityIds;

    @Schema(description = "赠品活动快照数据")
    @JsonIgnore
    private String giftActivitySnapshot;

    @Schema(description = "赠品活动信息")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private List<GiftActivityVO> giftActivities;

    @SuppressWarnings("unused")
    public List<GiftActivityVO> getGiftActivities() {
        if (!JsonUtils.isJson(getGiftActivitySnapshot())) {
            return null;
        }
        return JsonUtils.parseArray(getGiftActivitySnapshot(), GiftActivityVO.class);
    }

}
